package vo;

import java.util.List;




import logic.utility_logic.NoSuchElementException;
import po.ModelPO;

public class ModelVO {
	ModelPO model;
	List<SubModelVO> subModelList;
	
	public ModelVO(ModelPO model, List<SubModelVO> subModelList) {
		super();
		this.model = model;
		this.subModelList = subModelList;
	}
	public List<SubModelVO> getSubModelList() {
		return subModelList;
	}
	public String getModelID() {
		return model.getModelID();
	}
	public String getName(){
		return model.getName();
	}
	public int getHeadCredit(){
		return model.getHeadCredit();
	}
	public int getTailCredit(){
		return model.getTailCredit();
	}
	public ModelPO getModel() {
		return model;
	}

	public SubModelVO getSubModel(String submodelID){
		for(SubModelVO smv : subModelList){
			if(smv.getSubModel().getSubModelID().equals(submodelID)){
				return smv;
			}
		}
		throw new NoSuchElementException();
	}
	@Override
	public String toString() {
		return "ModelVO [model=" + model + ", subModelList=" + subModelList
				+ "]";
	}
	
}
